import 'package:flutter/widgets.dart';

typedef SliverPersistentHeaderBuilder = Widget Function(BuildContext context, double shrinkOffset, bool overlapsContent, double minExtent, double maxExtent);

class CustomSliverPersistentHeaderDelegate extends SliverPersistentHeaderDelegate {
  
  final SliverPersistentHeaderBuilder builder;
  @override
  final double maxExtent;

  @override
  final double minExtent;

  CustomSliverPersistentHeaderDelegate({ required this.builder, required this.maxExtent, required this.minExtent });

  @override
  Widget build(BuildContext context, double shrinkOffset, bool overlapsContent) {
    return builder(context, shrinkOffset, overlapsContent, minExtent, maxExtent);
  }

  @override
  bool shouldRebuild(covariant SliverPersistentHeaderDelegate oldDelegate) {
    return false;
  }
}